﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>分享截图抽查-微街秀管理后台</title>
    <link href="../../Client/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet"
        type="text/css" />
    <link href="../../Client/css/base.css" rel="stylesheet" type="text/css" />
    <style>
        body{font-size: 12px;}
        .navigation{padding-left: 5px;color: rgb(153, 153, 153);font-family: '宋体';line-height: 28px;}
        .navigation{padding: 10px;}
        .navigation .back{float: right;padding-left: 18px;background: url(/admin/img/arrow_left.png) no-repeat left 5px;}
        .tab_nav{margin: 8px auto;height: 23px;line-height: 23px;border-bottom: 1px rgb(225, 225, 225) solid;font-family: "微软雅黑";margin: 0px;list-style: none;padding: 0px;}
        .tab_nav li{float: left;height: 22px;margin: 0 2px 0 5px;border: 1px rgb(225, 225, 225) solid;border-bottom: 0;background: url(/admin/img/btn_bg.gif) repeat-x;text-align: center;padding: 0 10px 0 10px;}
        .img-body{width: 140px;height: 220px;overflow: hidden;}
        .img-body > img{width: 140px;height: auto;}
        .mt50{width: 150px;}
    </style>
</head>
<body class="mainbody">
    <div class="navigation">
        <a href="javascript:" class="back">后退</a>首页 &gt; <a href="list.html">发财管理</a> &gt; <span class="title">朋友圈截图审核</span> &gt; <span id="is_pass">未审核</span></div>
    <ul class="tab_nav">
        <li class="selected"><a href="javascript:;" onclick="Search(0)">未审核</a></li>
        <li class="selected"><a href="javascript:;" onclick="Search(1)">已审核</a></li>
        <li class="selected"><a href="javascript:;" onclick="Search(2)">已拒绝</a></li>
    </ul>
    <div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
        <div class="modal-dialog modal-lg">
            <div class="modal-content text-center">
                <img id="modalImg" />
            </div>
        </div>
    </div>
    <div class="container-fluid text-center">
        <div class="row" id="imgsBody">
        </div>
    </div>
    <script src="../js/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script src="../js/base.js" type="text/javascript"></script>
    <script src="../js/ajax-data.js" type="text/javascript"></script>
    <script src="../js/dialog.js" type="text/javascript"></script>
    <script src="../../Client/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
    <script>
        var is_pass = "0";
        $(function () {
            init();
            GetList();
        });

        //初始化
        function init() {
            $("#modalImg").css("height", $(window).height() + "px")
            $("#modalImg").css("width", "auto")
            is_pass = (getQueryString("is_pass") == null ? "0" : getQueryString("is_pass"));
            
            if (is_pass != null && is_pass.indexOf("3") > -1)
                $(".title").html("朋友圈二次审核");
        }


        //填充数据
        function GetList() {
            $("#imgsBody").html("");
            var html = '<div class="col-lg-2 col-md-3 col-xm-3 col-xs-6 mt50"><div class="img-body"><img src="{img}" onclick="showImg(\'{img}\');" /></div><div class="text-left">用户id:{by_user_id}</div><div class="text-left">状态:<span id = "pass{id}">{stateName}</span></div><div class="text-left">操作:&nbsp;&nbsp;<a href = "JavaScript:changeState({id},2);">拒绝</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href = "JavaScript:changeState({id},1);">通过</a></div></div>';
            var id = getUrlArgStr("id");            
            AjaxStart("../ajax/FC_Shared.ashx?GetDetailList&id=" + id + "&is_pass=" + is_pass, "", function (data) {
                if (data.code != 0) {
                    $("#list").html(html + "<tr><td colspan='8'>" + data.msg + "</td></tr>");
                }
                else {
                    $(data.item).each(function () {
                        var is_pass = '未审核';
                        if (this.is_pass == 1)
                            is_pass = '已通过';
                        else if (this.is_pass == 2)
                            is_pass = '已拒绝';
                        else if (this.is_pass == 3)
                            is_pass = '等待审核';
                        $("#imgsBody").append(html.replace(/{img}/g, this.picurl).replace(/{by_user_id}/g, this.by_user_id).replace(/{id}/g, this.id).replace(/{stateName}/g, is_pass));
                    });
                }
            });
        }

        function Search(state) {
            is_pass = state;
            $("#is_pass").html("未审核");
            if (state == 0 && getQueryString("is_pass").indexOf("3") > -1) 
                is_pass = 3;        //二次审核状态
            else if (state == 1)
                $("#is_pass").html("已审核");
            else if (state == 2)
                $("#is_pass").html("已拒绝");
                          
            GetList();
        }

        //显示大图
        function showImg(src) {
            $("#modalImg").attr("src", src);
            $(".modal").modal("show");
        }

        function changeState(id, isPass) {
            if (is_pass == 2) {
                if (!confirm("拒绝后,客户的红包金额被冻结，确定吗？")) return;
            }
            AjaxStart("../ajax/FC_Shared.ashx?ChangeIsPass&id=" + id + "&is_pass=" + isPass, "", function (data) {
                if (data.code != 0) {
                    alert(data.msg);
                    return;
                }
                if (isPass == 2)
                    Alert("拒绝成功");
                else 
                    Alert("通过成功");
                $("#pass" + id).text(isPass == 1 ? "已通过" : "已拒绝");
            });
        }
    </script>
</body>
</html>
